$("#Switchbox", window.parent.document).on("click", function () {
    ModeSwitch.modeSwitch();
    commonbgcolor();
    friendbgcolor();
})

$("#friend", window.parent.document).on("click", function () {
    AJAX();
    iframeOn('friend');
})

//AJAX获取友链
var html;

function AJAX() {
    $.ajax({
        type: 'POST',
        dataType: 'json',
        url: '/friend',
        success: function (result) {
            html = '';
            result.forEach(function (item) {
                html += `
                            <div class="modecard ModeBG">
                                <p class="friendID">${item.id}</p>
                                <img src="${item.imgsrc}" class="friendlogo">
                                <p class ="friendslogan">${item.slogan.replaceAll('<br />',' ')}</p>
                                <div class ="friendBtn">
                                    <a href="${item.blogurl}" target="_blank">前往</a>
                                </div>
                            </div>
                            `
            })
            document.getElementById('friendbox').innerHTML = html;
            iframeOn();
        }
    })
}